package com.xuecheng.content.api;

import com.xuecheng.base.execption.ValidationGroups;
import com.xuecheng.base.model.PageParams;
import com.xuecheng.base.model.PageResult;
import com.xuecheng.base.model.dto.AddCourseDto;
import com.xuecheng.base.model.dto.CourseBaseInfoDto;
import com.xuecheng.base.model.dto.EditCourseDto;
import com.xuecheng.base.model.dto.QueryCourseParamsDto;
import com.xuecheng.base.model.po.CourseBase;
import com.xuecheng.base.model.po.CourseTeacher;
import com.xuecheng.base.service.CourseTeacherService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @description 教师信息管理接口
 * @author Mr.M
 * @date 2022/9/6 11:29
 * @version 1.0
 */
@RestController
@Slf4j
@Api(value = "课程教师信息管理接口",tags = "课程教师信息管理接口")
public class CourseTeacherController {
    @Autowired
    private CourseTeacherService courseTeacherService;
    @ApiOperation("教师查询接口")
    @GetMapping("/courseTeacher/list/{courseId}")
    public List<CourseTeacher> list(@PathVariable Long courseId){
        return courseTeacherService.courseTeacherList(courseId);

    }
    @ApiOperation("新增教师信息")
    @PostMapping("/courseTeacher")
    public CourseTeacher createCourseTeacher(@RequestBody CourseTeacher courseTeacher){
        //机构id，由于认证系统没有上线暂时硬编码
        Long companyId = 1232141425L;
        return courseTeacherService.createCourseTeacher(companyId,courseTeacher);
    }
    @ApiOperation("根据id查询教师信息")
    @GetMapping("/courseTeacher/{id}")
    public CourseTeacher getCourseTeacherById(@PathVariable Long id){
        CourseTeacher courseTeacher = courseTeacherService.getCourseTeacher(id);
        return courseTeacher;
    }
    @ApiOperation("修改教师基础信息")
    @PutMapping("/courseTeacher")
    public CourseTeacher modifyCourseTeacher(@RequestBody CourseTeacher courseTeacher){
        //机构id，由于认证系统没有上线暂时硬编码
        Long companyId = 1232141425L;
        return courseTeacherService.updateCourseTeacher(companyId,courseTeacher);
    }
    @ApiOperation("删除教师信息")
    @DeleteMapping("/courseTeacher/course/{courseId}/{id}")
    public void deleteCourseTeacher(@PathVariable Long courseId,@PathVariable Long id){
        //机构id，由于认证系统没有上线暂时硬编码
        Long companyId = 1232141425L;
        courseTeacherService.deleteCourseTeacher(companyId,courseId,id);
    }
}
